package com.sub.controller;


import com.sub.pojo.dto.LoginParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;


@Slf4j
@RestController
@RequestMapping("/login")
public class LoginController {



    @GetMapping("/hello")
    public String sayHello(String param){
        log.info("param = "+ param);
        return "hello hello 这里是"+param;
    }

    @PostMapping("/relogin")
    public String reLogin(LoginParam loginParam){
        if ("123456".equals(loginParam.getPassword())){
            return loginParam.getUsername()+"登录成功!\n 登录时间："+new Date();
        }else {
            return "登录失败！请检查密码后重试";
        }
    }



}
